/*
 * Copyleft 2011 Power by Colen.
 *
 * Project: booking
 * Date: Jul 2, 2011
 */
package com.crm.common.web.service.impl;

import com.crm.common.service.CommonServiceEx;
import com.crm.common.service.pub.CodeDataService;
import com.crm.common.service.pub.SequenceService;
import com.crm.common.web.service.WebCommonService;


/**
 * Common Service
 *
 * @author Colen
 *
 */
public class WebCommonServiceImpl extends CommonServiceEx implements WebCommonService {

    /**
     * get name by code value
     *
     * @param codeKey
     * @param value
     * @return
     */
    protected String getCdNmByValue(String codeKey, Object value) {
        if (value == null) {
            return null;
        }

        return this.codeDataService.getNmByValue(codeKey, value.toString());
    }
    
    /**
     * get name by code value (ABBR)
     *
     * @param codeKey
     * @param value
     * @return
     */
    protected String getCdAbbrNmByValue(String codeKey, String value) {
        if (value == null) {
            return null;
        }
        
        return this.codeDataService.getAbbrNmByValue(codeKey, value.toString());
    }
    
    /**
     * get next sequence
     *
     * @param seqId
     * @return
     */
    protected String nextSeq(String seqId) {
        return this.seqService.nextSeq(seqId);
    }

    /** Code Data Service */
    private CodeDataService codeDataService = null;

    /** Sequence Service */
    private SequenceService seqService = null;


    /**
     * @param seqService
     */
    public void setSeqService(SequenceService seqService) {
        this.seqService = seqService;
    }
    
    /**
     * @return the seqService
     */
    public SequenceService getSeqService() {
        return seqService;
    }

    /**
     * Getter
     * 
     * @return the codeDataService
     */
    public CodeDataService getCodeDataService() {
        return codeDataService;
    }

    /**
     * @param codeDataService
     */
    public void setCodeDataService(CodeDataService codeDataService) {
        this.codeDataService = codeDataService;
    }

}
